﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

public partial class Ajax_AjaxUpload : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        UploadFile();
    }
    private void UploadFile()
    {
        if ((filUpload.PostedFile != null) && (filUpload.PostedFile.ContentLength > 0))
        {
            int lastIndex = filUpload.PostedFile.FileName.LastIndexOf("\\") + 1;
            string fileName = filUpload.PostedFile.FileName.Substring(lastIndex, filUpload.PostedFile.FileName.Length - lastIndex);
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", string.Format("<script>upload('{0}');</script>", fileName));
            Stream stream = filUpload.PostedFile.InputStream;
        }
    }
}
